export {};
// 定义一个函数，获取输入对象指定key的值
const getProp = <T extends object, K extends keyof T>(obj: T, key: K): T[K] => {
  // 返回值
  return obj[key];
};

console.log(getProp({ a: 1, b: 'b' }, 'a'));

console.log(getProp({ name: 'Jack', age: 18, score: 100 }, 'score'));
console.log(getProp({ name: 'Rose', age: 18, score: 90 }, 'age'));
